package com.zjj.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;

@Service
public class UserServer {

	@Autowired
	private RestTemplate restTemplate;
	
	@HystrixCommand(fallbackMethod="fallbackTest")
	public String test() {
		return restTemplate.getForObject("http://EUREKA-CLIENT/home", String.class);
	}
	
	public String fallbackTest() {
		return "This is fallback message!";
	}
}
